<template>
  <div class="cell-btn-box">
    <el-button
      v-bind="tableItem.config||{}"
      @click="clickBtn"
    >
      {{ tableItem.btnText||scopeData.row[tableItem.prop] }}
    </el-button>
  </div>
</template>

<script>
export default {
  name: 'CellBtn',
  props: {
    // 单元格数据
    scopeData: {
      type: Object,
      default: () => ({})
    },
    // 单元格配置项
    tableItem: {
      type: Object,
      default: () => ({})
    },
    // 表格数据
    tableData: {
      type: Object,
      default: () => ({})
    }
  },
  data() {
    return {}
  },
  methods: {
    clickBtn() {
      const { btnText } = this.tableItem || {}
      if (btnText) {
        this.$emit('clickBtn', this.tableItem, this.scopeData.row)
      }
    }
  }
}
</script>

<style lang="scss" scoped>

</style>
